package cn.car91.activity;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import cn.car91.config.InitApplication;

import com.lidroid.xutils.DbUtils;
import com.lidroid.xutils.ViewUtils;

public class BaseFragmentActivity extends FragmentActivity {
    DbUtils placeDbUtils;

    static InitApplication car91Application;

    public InitApplication getCar91Application() {
        return car91Application;
    }

    public interface Car91ResultCode {
        int Refresh_User_Code = 10000;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        ViewUtils.inject(this);

        car91Application = (InitApplication) getApplication();
        registerReceiver(exitBroadcastReceiver, new IntentFilter(BaseActivity.exitAction));
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onDestroy() {
        unregisterReceiver(exitBroadcastReceiver);
        super.onDestroy();
    }

    private BroadcastReceiver exitBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context arg0, Intent arg1) {
            // TODO Auto-generated method stub
            finish();
        }
    };
}
